package light.head.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * 库存物品表
 *
 */
@Entity
@Table
public class Stock implements Serializable {
	
	private static final long serialVersionUID = 3583016665457730728L;
	
	private Integer code;
	private Integer gc;							// 物品编号
	private Integer stockcount;					// 库存数量
	private Integer oc;							//机构编号
	private Boolean deleted;
	private Byte sort;							//所属类别

	private String on;							//机构名称
	private String gn;							//商品名称
	private String norms;						//规格
	private String type;						//型号

	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column(length = 20)
	public Integer getGc() {
		return gc;
	}

	@Column
	public Integer getStockcount() {
		return stockcount;
	}

	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Formula("(SELECT g.name FROM Goods g WHERE g.code = gc)")
	public String getGn() {
		return gn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc )")
	public String getOn() {
		return on;
	}
	@Formula("(SELECT g.sort FROM Goods g WHERE g.code = gc)")
	public Byte getSort() {
		return sort;
	}
	@Formula("(SELECT g.norms FROM Goods g WHERE g.code = gc)")
	public String getNorms() {
		return norms;
	}
	@Formula("(SELECT g.type FROM Goods g WHERE g.code = gc)")
	public String getType() {
		return type;
	}
	
	
	
	
	
	
	public void setNorms(String norms) {
		this.norms = norms;
	}
	public void setType(String type) {
		this.type = type;
	}
	public void setSort(Byte sort) {
		this.sort = sort;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setOn(String on) {
		this.on = on;
	}
	public void setGn(String gn) {
		this.gn = gn;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setGc(Integer gc) {
		this.gc = gc;
	}

	public void setStockcount(Integer stockcount) {
		this.stockcount = stockcount;
	}

	
	

}
